package net.wang.concurrency.test.threadPool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;


@Slf4j
public class ThreadPoolExample4 {

    public static void main(String[] args) {
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5);

        scheduledExecutorService.schedule(() -> log.info("schedule run"), 3, TimeUnit.SECONDS);

       // scheduledExecutorService.scheduleAtFixedRate(() -> log.info("schedule run"), 3, 3, TimeUnit.SECONDS);

        scheduledExecutorService.shutdown();
    }
}
